package com.springboot.cloud.authentication.provider;

import com.springboot.cloud.core.model.SystemResource;
import com.springboot.cloud.core.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Set;

/**
 * <p> 调用远程的系统服务获取资源 </p>
 *
 * @author Bertram
 * @since 11/5/2019 2:30 PM
 */
@FeignClient(name = "system-service", fallback = ResourceProviderFallback.class)
public interface ResourceProvider {
    /**
     * 获取所有的资源信息
     * @return
     */
    @GetMapping(value = "/system_resource/all")
    Result<Set<SystemResource>> resources();

    /**
     * 获取登录用户的资源信息
     * @param username
     * @return
     */
    @GetMapping(value = "/system_resource/user/{username}")
    Result<Set<SystemResource>> resources(@PathVariable("username") String username);
}
